import java.util.Scanner;

public class 空心 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入一个数字");
        int a= scanner.nextInt();
        for (int i = 0; i <a; i++) {
            for (int j = 0; j <a; j++) {
                if (i==0||i==a-1) {
                    System.out.print("*");
                }
                else if (j==0||j==a-1){
                        System.out.print("*");

                }
                else{
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
